package main

import "fmt"

func main() {
	//year := 144
	//switch year {
	//case 1:
	//	fmt.Println("第一季度")
	//case 2:
	//	fmt.Println("第二季度")
	//case 3:
	//	fmt.Println("第三季度")
	//case 4:
	//	fmt.Println("第四季度")
	//default:
	//	fmt.Println("no")
	//}

	month := 5
	year := 2020
	num := 0

	switch month {
	case 1, 3, 5, 7, 8, 10, 12:
		num = 31
	case 4, 6, 9, 11:
		num = 30
	case 2:
		if year%400 == 0 || year%4 == 0 && year%100 != 0 {
			num = 29
		} else {
			num = 28
		}
		fmt.Println(num)
	default:
		fmt.Println("错误数据")
	}
	fmt.Println(num)

	switch lang := "golang"; lang {
	case "golang":
		fmt.Println("golang")
	case "Java":
		fmt.Println("Java")
	case "php":
		fmt.Println("php")
	}

	//fallthrough 穿透 switch 当某一个 case 执行后 遇到 fallthrough 下一个 case 直接执行
	m := 2
	switch m {
	case 1:
		fmt.Println("第1季度")
	case 2:
		fmt.Println("第2季度")
		fallthrough
	case 3:
		fmt.Println("第3季度")
		fallthrough
	case 4:
		fmt.Println("第4季度")
	}
}
